<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="path" value="${pageContext.request.contextPath}"></c:set>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Edit Reader</title>

<script type="text/javascript" src="${path}/js/jquery-1.10.2.js"></script>
<link rel="stylesheet"
	href="${path}/js/validator-0.7.3/jquery.validator.css">
<script type="text/javascript"
	src="${path}/js/validator-0.7.3/jquery.validator.js"></script>
<script type="text/javascript"
	src="${path}/js/validator-0.7.3/local/zh_CN.js"></script>
<script type="text/javascript"
	src="${path}/js/jbox-v2.3/jBox/jquery.jBox-2.3.min.js"></script>
<script type="text/javascript"
	src="${path}/js/jbox-v2.3/jBox/i18n/jquery.jBox-zh-CN.js"></script>
<link type="text/css" rel="stylesheet"
	href="${path}/js/jbox-v2.3/jBox/Skins/Default/jbox.css" />

<!-- BEGIN GLOBAL MANDATORY STYLES -->

<link href="${path}/css/basic/bootstrap.min.css" rel="stylesheet"
	type="text/css" />

<link href="${path}/css/basic/bootstrap-responsive.min.css"
	rel="stylesheet" type="text/css" />

<link href="${path}/css/basic/font-awesome.min.css" rel="stylesheet"
	type="text/css" />

<link href="${path}/css/basic/style-metro.css" rel="stylesheet"
	type="text/css" />

<link href="${path}/css/basic/style.css" rel="stylesheet"
	type="text/css" />

<link href="${path}/css/basic/style-responsive.css" rel="stylesheet"
	type="text/css" />

<link href="${path}/css/basic/default.css" rel="stylesheet"
	type="text/css" id="style_color" />

<link href="${path}/css/basic/uniform.default.css" rel="stylesheet"
	type="text/css" />

<!-- END GLOBAL MANDATORY STYLES -->

</head>

<body>

	<!-- BEGIN PAGE CONTAINER-->

	<div class="container-fluid">

		<!-- BEGIN PAGE HEADER-->

		<div class="row-fluid">

			<div class="span12">

				<!-- BEGIN PAGE TITLE & BREADCRUMB-->

				<h3 class="page-title">Edit Reader</h3>

				<ul class="breadcrumb">

					<li><i class="icon-home"></i> <a href="${path}/admin/main">Home</a>
						<span class="icon-angle-right"></span></li>

					<li>Edit Reader</li>

				</ul>

				<!-- END PAGE TITLE & BREADCRUMB-->

			</div>

		</div>

		<!-- END PAGE HEADER-->

		<!-- BEGIN PAGE CONTENT-->

		<div class="row-fluid">

			<div class="span12">

				<!-- BEGIN SAMPLE FORM PORTLET-->

				<div class="portlet box green tabbable">

					<div class="portlet-title">

						<div class="caption">

							<i class="icon-reorder"></i>Edit Reader

						</div>

					</div>

					<div class="portlet-body form">

						<div class="tab-content">

							<!-- BEGIN FORM-->

							<form class="form-horizontal" action="${path}/readerinfo/save"
								method="post">
								<table>
									<tr>
										<td>
											<div class="control-group">
												<div class="controls">
													<input type="hidden" name="id" value="${readerInfo.id}" />
												</div>
											</div>
											<div class="control-group" style="width: 570px">
												<label class="control-label">Name:</label>
												<div class="controls">
													<input class="m-wrap medium" type="text" name="name" id="name1"
														value="${readerInfo.name}" placeholder="Enter Name"
														maxlength="15" />
												</div>
											</div> <c:if test="${readerInfo.sex == 'male'}">
												<div class="control-group">
													<label class="control-label">Sex:</label>
													<div class="controls" style="width: 370px">
														<label class="radio"> <input type="radio" id="sex1"
															name="sex" value="male" checked /> male
														</label> <label class="radio"> <input type="radio" id="sex2"
															name="sex" value="female" /> female
														</label>
													</div>
												</div>
											</c:if> <c:if test="${readerInfo.sex == 'female'}">
												<div class="control-group">
													<label class="control-label">Sex:</label>
													<div class="controls" style="width: 370px">
														<label class="radio"> <input type="radio" id="sex3"
															name="sex" value="male" /> male
														</label> <label class="radio"> <input type="radio" id="sex4"
															name="sex" value="female" checked /> female
														</label>
													</div>
												</div>
											</c:if>
											<div class="control-group">
												<label class="control-label">Phone:</label>
												<div class="controls" style="width: 370px">
													<input class="m-wrap medium" type="text" maxlength="11" 
														name="phone" id="phone1" value="${readerInfo.phone}"
														placeholder="Enter Phone" data-rule="required;mobile;"
														data-tip="Incorrect Phone Format" />
												</div>
											</div>
											<div class="control-group">
												<label class="control-label">Email:</label>
												<div class="controls" style="width: 370px">
													<input class="m-wrap medium" type="text" name="email" id="email1"
														value="${readerInfo.email}" placeholder="Enter Email"
														maxlength="15" data-rule="required;email;"
														data-tip="Incorrect Email Format" />
												</div>
											</div>
												<div class="control-group">
													<label class="control-label">Department:</label>
													<div class="controls">
														<select id="departName1" class="m-wrap medium" name="deptName"
															data-rule="required;" data-tip="Not Empty">
															<c:set var="departid" value="${readerInfo.deptId.id}"></c:set>
															<c:forEach items="${deptList}" var="deptList">
																<c:if test="${deptList.id == departid}">
																	<option value="${deptList.id}" selected="selected">${deptList.name}</option>
																</c:if>
																<c:if test="${deptList.id != departid}">
																	<option value="${deptList.id}">${deptList.name}</option>
																</c:if>
															</c:forEach>
														</select>
													</div>
												</div>
<!-- 											<div class="control-group"> -->
<!-- 												<label class="control-label">Department:</label> -->
<!-- 												<div class="controls" style="width: 370px"> -->
<!-- 													<input class="m-wrap medium" type="text" name="departName" id="departName1" -->
<%-- 														value="${readerInfo.deptId.name}" /> --%>
<!-- 												</div> -->
<!-- 											</div> -->
												<div class="control-group">
													<label class="control-label">Role:</label>
													<div class="controls">
														<select id="roleName1" class="m-wrap medium" name="roleName"
															data-rule="required;" data-tip="Not Empty">
															<c:set var="roleid" value="${readerInfo.roleId.id}"></c:set>
															<c:forEach items="${roleList}" var="roleList">
																<c:if test="${roleList.id == roleid}">
																	<option value="${roleList.id}" selected="selected">${roleList.name}</option>
																</c:if>
																<c:if test="${roleList.id != roleid}">
																	<option value="${roleList.id}">${roleList.name}</option>
																</c:if>
															</c:forEach>
														</select>
													</div>
												</div>
<!-- 											<div class="control-group"> -->
<!-- 												<label class="control-label">Role:</label> -->
<!-- 												<div class="controls" style="width: 370px"> -->
<!-- 													<input class="m-wrap medium" type="text" name="roleName" id="roleName1" -->
<%-- 														value="${readerInfo.roleId.name}" /> --%>
<!-- 												</div> -->
<!-- 											</div> -->

										</td>
										<td><c:if test="${empty requestScope.readerInfo}">
												<table class="table table-bordered table-hover">
													<thead>
														<tr>
															<th>#</th>
															<th>Book Name</th>
															<th>Borrowed Date</th>
														</tr>
													</thead>
													<tbody>
														<c:forEach items="${brList}" var="brInfo" varStatus="vs">
															<tr>
																<td>${vs.count}</td>
																<td>${brInfo.bookInfo.name}</td>
																<td>${brInfo.borrowedDate}</td>
															</tr>
														</c:forEach>
													</tbody>
												</table>
											</c:if></td>
									</tr>
								</table>
								<c:if test="${sessionScope.readerInfo.roleId.name == 'Reader'}">
									<script>
											$("#name1").attr("readonly","readonly");
											$("#departName1").attr("readonly","readonly");
											$("#roleName1").attr("readonly","readonly");
									</script>
								</c:if>
								<div class="form-actions">
									<div>
										<button class="btn blue" type="submit">
											<i class="icon-ok"></i> Save
										</button>
									</div>
								</div>
							</form>
							<!-- END FORM-->



						</div>

					</div>

				</div>

				<!-- END SAMPLE FORM PORTLET-->

			</div>

		</div>

		<!-- END PAGE CONTENT-->

	</div>

	<!-- END PAGE CONTAINER-->


	<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->

	<!-- BEGIN CORE PLUGINS -->

	<script src="${path}/js/basic/jquery-1.10.1.min.js"
		type="text/javascript"></script>

	<script src="${path}/js/basic/jquery-migrate-1.2.1.min.js"
		type="text/javascript"></script>

	<!-- IMPORTANT! Load jquery-ui-1.10.1.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->

	<script src="${path}/js/basic/jquery-ui-1.10.1.custom.min.js"
		type="text/javascript"></script>

	<script src="${path}/js/basic/bootstrap.min.js" type="text/javascript"></script>

	<!--[if lt IE 9]>

	<script src="${path}/js/basic/excanvas.min.js"></script>

	<script src="${path}/js/basic/respond.min.js"></script>  

	<![endif]-->

	<script src="${path}/js/basic/jquery.slimscroll.min.js"
		type="text/javascript"></script>

	<script src="${path}/js/basic/jquery.blockui.min.js"
		type="text/javascript"></script>

	<script src="${path}/js/basic/jquery.cookie.min.js"
		type="text/javascript"></script>

	<script src="${path}/js/basic/jquery.uniform.min.js"
		type="text/javascript"></script>

	<!-- END CORE PLUGINS -->

	<script src="${path}/js/basic/app.js"></script>

	<script>
		jQuery(document).ready(function() {

			// initiate layout and plugins

			App.init();

		});
	</script>

	<!-- END JAVASCRIPTS -->

</body>
</html>